<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.minshenglife.zanzan.pub.Config" %>
	<%
	String rootPath = Config.getProperty(Config.WX_BASEURL);//应用的根路径
	%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=rootPath%>">
    
    <title>密码修改</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
  </head>
  
  <body>
  	<h3>${error}</h3>
  <form action="<%=rootPath%>/userLogin/updatePassWord.power" method="post" id='formPass'>
  	员工姓名<input type="text" name="emp_name" disabled="disabled" value="${emp_name}"/><br>
  		<input type="hidden" name="empId" value="${empId}"/>
  	员工工号<input type="text" value="${empId}" disabled="disabled"/><br>
  	旧密码<input type="password" name="formerPassWord" id="formerPassWord" onblur="valuformer()"/><br>
  	新密码<input type="password" name="newPassword" id="newPassword" onblur="passWord()"/><br>
  	重复新密码<input type="password" name="newPassword1" id="newPassword1" onblur="passWord1()"/><br>
  	<input type="button" value="保存" onclick="valudate()"/>
  </form>
  </body>
</html>
<script type="text/javascript" src="<%=rootPath%>/jsp/power/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
	function valudate(){
		if(valuformer()&&passWord()&&passWord1()){
			$("#formPass").submit();
		}else{
			alert("密码有错误");
		}
	}
	function valuPassWord(s){
		var patrn=/^(\w){6,20}$/;  
		if (!patrn.exec(s)) return false;
		return true;
	}
	function valuformer(){
		var formerPassWord = document.getElementById("formerPassWord").value;
		if(!valuPassWord(formerPassWord)){
			alert("旧密码格式或个数不正确");
			return false;
		}
		return true;
	}
	function passWord(){
		var password1 = document.getElementById("newPassword").value;
		if(!valuPassWord(password1)){
			alert("新密码格式或个数不正确");
			return false;
		}
		return true;
	}
	function passWord1(){
		var password1 = document.getElementById("newPassword").value;
		var password2 = document.getElementById("newPassword1").value;
		if(!password1 == password2){
			alert("重复新密码格式或个数不正确");
			return false;
		}
		return true;
	}
</script>
